## The function next_q(r,t) concerning PRS codes

from PyM import *

# def next_q(r,t=''):
#     # Assume x is a positive real number and t a positive integer
#     if t=='': n = ceiling(r)
#     else: n = ceiling(1+2*t/(1-r))
#     while not is_prime_power(n):
#         n+=1
#     return n

# Examples

show( next_q(73.4))

show( next_q(3/4,7))

show( next_q(3/4,10))

R = [0.50,0.55,0.60,0.65,0.70,0.75,0.80]

Q = [[next_q(r,t) for t in range(1,13)] for r in R]

show( matrix(Q) )